package com.shw.system.sms.aliyun;

import java.util.HashMap;
import java.util.Map;

/**
 * <阿里云短信API调用错误码>
 *
 * @author wangxu
 * @version 1.0
 * @date 2020/04/18 0:31
 */
public class AliyunSmsErrorCode {

    /**
     * Aliyun短信API错误码
     * 官网错误码及解决方案介绍：https://help.aliyun.com/document_detail/101346.html?spm=a2c4g.11186623.6.621.57532246HXxary
     */
    private static final Map<String, String> ALIYUN_SMS_ERROR_CODE = new HashMap<>();

    /*初始化*/
    static {
        ALIYUN_SMS_ERROR_CODE.put("OK", "短信发送成功！");
        ALIYUN_SMS_ERROR_CODE.put("isv.SMS_SIGNATURE_SCENE_ILLEGAL", "短信所使用签名场景非法");
        ALIYUN_SMS_ERROR_CODE.put("isv.EXTEND_CODE_ERROR", "扩展码使用错误，相同的扩展码不可用于多个签名");
        ALIYUN_SMS_ERROR_CODE.put("isv.DOMESTIC_NUMBER_NOT_SUPPORTED", "国际/港澳台消息模板不支持发送境内号码");
        ALIYUN_SMS_ERROR_CODE.put("isv.DENY_IP_RANGE", "源IP地址所在的地区被禁用");
        ALIYUN_SMS_ERROR_CODE.put("isv.DAY_LIMIT_CONTROL", "触发日发送限额");
        ALIYUN_SMS_ERROR_CODE.put("isv.SMS_CONTENT_ILLEGAL", "短信内容包含禁止发送内容");
        ALIYUN_SMS_ERROR_CODE.put("isv.SMS_SIGN_ILLEGAL", "签名禁止使用");
        ALIYUN_SMS_ERROR_CODE.put("isp.RAM_PERMISSION_DENY", "RAM权限DENY");
        ALIYUN_SMS_ERROR_CODE.put("isv.OUT_OF_SERVICE", "业务停机");
        ALIYUN_SMS_ERROR_CODE.put("isv.PRODUCT_UN_SUBSCRIPT", "未开通云通信产品的阿里云客户");
        ALIYUN_SMS_ERROR_CODE.put("isv.PRODUCT_UNSUBSCRIBE", "产品未开通");
        ALIYUN_SMS_ERROR_CODE.put("isv.ACCOUNT_NOT_EXISTS", "账户不存在");
        ALIYUN_SMS_ERROR_CODE.put("isv.ACCOUNT_ABNORMAL", "账户异常");
        ALIYUN_SMS_ERROR_CODE.put("isv.SMS_TEMPLATE_ILLEGAL", "短信模版不合法");
        ALIYUN_SMS_ERROR_CODE.put("isv.SMS_SIGNATURE_ILLEGAL", "短信签名不合法");
        ALIYUN_SMS_ERROR_CODE.put("isv.INVALID_PARAMETERS", "参数异常");
        ALIYUN_SMS_ERROR_CODE.put("isv.SYSTEM_ERROR", "isp.SYSTEM_ERROR(系统错误)");
        ALIYUN_SMS_ERROR_CODE.put("isv.MOBILE_NUMBER_ILLEGAL", "非法手机号");
        ALIYUN_SMS_ERROR_CODE.put("isv.MOBILE_COUNT_OVER_LIMIT", "手机号码数量超过限制");
        ALIYUN_SMS_ERROR_CODE.put("isv.TEMPLATE_MISSING_PARAMETERS", "模版缺少变量");
        ALIYUN_SMS_ERROR_CODE.put("isv.BUSINESS_LIMIT_CONTROL", "业务限流");
        ALIYUN_SMS_ERROR_CODE.put("isv.INVALID_JSON_PARAM", "JSON参数不合法，只接受字符串值");
        ALIYUN_SMS_ERROR_CODE.put("isv.BLACK_KEY_CONTROL_LIMIT", "黑名单管控");
        ALIYUN_SMS_ERROR_CODE.put("isv.PARAM_LENGTH_LIMIT", "参数超出长度限制");
        ALIYUN_SMS_ERROR_CODE.put("isv.PARAM_NOT_SUPPORT_URL", "不支持URL");
        ALIYUN_SMS_ERROR_CODE.put("isv.AMOUNT_NOT_ENOUGH", "账户余额不足");
        ALIYUN_SMS_ERROR_CODE.put("isv.TEMPLATE_PARAMS_ILLEGAL", "模版变量里包含非法关键字");
        ALIYUN_SMS_ERROR_CODE.put("SignatureDoesNotMatch", "Specified signature is not matched with our calculation(签名（Signature）加密错误)");
        ALIYUN_SMS_ERROR_CODE.put("InvalidTimeStamp.Expired", "Specified time stamp or date value is expired（由于时区差异造成时间戳错误，发出请求的时间和服务器接收到请求的时间不在15分钟内。\n" +
                "阿里云网关使用的时间是GMT时间，请使用GMT时间）");
        ALIYUN_SMS_ERROR_CODE.put("SignatureNonceUsed", "Specified signature nonce was used already(唯一随机数重复，SignatureNonce为唯一随机数，用于防止网络重放攻击,不同请求请使用不同的随机数值)");
        ALIYUN_SMS_ERROR_CODE.put("InvalidVersion", "Specified parameter Version is not valid(版本号（Version）错误)");
        ALIYUN_SMS_ERROR_CODE.put("InvalidAction.NotFound", "Specified api is not found, please check your url and method(参数Action中指定的接口名错误,请在参数Action中使用正确的接口地址和接口名)");
        ALIYUN_SMS_ERROR_CODE.put("isv.SIGN_COUNT_OVER_LIMIT", "一个自然日中申请签名数量超过限制");
        ALIYUN_SMS_ERROR_CODE.put("isv.TEMPLATE_COUNT_OVER_LIMIT", "一个自然日中申请模板数量超过限制");
        ALIYUN_SMS_ERROR_CODE.put("isv.SIGN_NAME_ILLEGAL", "签名名称不符合规范");
        ALIYUN_SMS_ERROR_CODE.put("isv.SIGN_FILE_LIMIT", "签名认证材料附件大小超过限制");
        ALIYUN_SMS_ERROR_CODE.put("isv.SIGN_OVER_LIMIT", "签名字符数量超过限制");
        ALIYUN_SMS_ERROR_CODE.put("isv.TEMPLATE_OVER_LIMIT", "签名字符数量超过限制");
    }


    public static Map<String, String> getAliyunSmsErrorCode() {
        return ALIYUN_SMS_ERROR_CODE;
    }

}
